package com.gotrade.demo.controller;

import com.gotrade.demo.exception.ServiceException;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author jason.tang
 * @create 2018-09-21 15:25
 * @description 主页控制层
 */
@RestController
@RequestMapping("/index")
public class IndexController {

    @GetMapping("/{id}")
    public String getCategory(@PathVariable("id") Integer id) {
        if (id == null || id >= 5 || id <= 0) {
            throw new ServiceException("参数不能为空或者不正确，请传输正确的参数!");
        }
        return "success";
    }
}